package cn.itcast.domain;

import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldIndex;
import org.springframework.data.elasticsearch.annotations.FieldType;

/**
 * Created by Think on 2017/10/6.
 * 创建索引库映射
 */
@Document(indexName = "blog03",type = "article") //指定索引库名称和文档类型
public class Article {

    @Id
    @Field(index= FieldIndex.not_analyzed,store=true,type = FieldType.Integer)
    private Integer id;
    @Field(index = FieldIndex.analyzed,analyzer = "ik",searchAnalyzer = "ik",type = FieldType.String,store = true)
    private String title;
    @Field(index = FieldIndex.analyzed,analyzer = "ik",searchAnalyzer = "ik",type = FieldType.String,store = true)
    private String content;
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    @Override
    public String toString() {
        return "Article [id=" + id + ", title=" + title + ", content=" + content + "]";
    }


}
